<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:composition template="../WEB-INF/facelets/template.xhtml">
        <ui:param name="title" value="Vrångö IF Gym – Start" />
        <ui:define name="content">

            <h:form>
                <p:wizard widgetVar="wiz" flowListener="#{BookingBackingBean.onFlowProcess}">

                    <p:tab title="Dag" id="day">
                        <p:panel header="Välj en dag">
                            <h:panelGrid columns="2">
                                <p:calendar  id="calendar"
                                             mode="inline" 
                                             value="#{BookingBackingBean.date}"
                                             mindate="#{BookingBackingBean.currentDate}" 
                                             maxdate="#{BookingBackingBean.maxDate}"
                                             selectListener="#{BookingBackingBean.dateSelectedListener}" 
                                             required="true"
                                             />

                                <p:message for="calendar"/>
                            </h:panelGrid>
                        </p:panel>
                    </p:tab>

                    <p:tab title="Tid" id="session"> 
                        <p:panel header="Välj en tid">
                            <p:dataTable id="dataTable"
                                         selectionMode="single" 
                                         selection="#{BookingBackingBean.selectedWorkoutSession}"
                                         value="#{BookingBackingBean.getAvailableWorkoutSessions()}"
                                         var="ws"
                                         >


                                <p:column headerText="Session">
                                    #{ws}
                                </p:column>

                            </p:dataTable>
                            <p:message for="dataTable"/>
                            <h:panelGroup>
                                <h:panelGrid columns="2">
                                    <h:outputLabel value="Antal deltagare"/>
                                    <h:selectOneMenu value="#{BookingBackingBean.selectedNumberOfParticipant}">
                                        <f:selectItems value="#{BookingBackingBean.getMaxGroupParticipants()}"/> 
                                    </h:selectOneMenu>
                                </h:panelGrid>
                                <h:panelGrid columns="2">
                                    <h:outputLabel value="Bokningskommentar"/>
                                    <h:inputTextarea value="#{BookingBackingBean.bookingComment}"/>
                                </h:panelGrid>
                                <h:panelGrid columns="1">
                                    <p:commandButton value="Lägg till bokning" 
                                                     action="onBookingCompleted" 
                                                     actionListener="#{BookingCtrl.addBooking}"
                                                     ajax="false"/>
                                </h:panelGrid>
                            </h:panelGroup>


                        </p:panel>
                    </p:tab>

                </p:wizard>
            </h:form>

        </ui:define>
    </ui:composition>
</html>